package com.mayblackcat.amoy.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.mayblackcat.common.vaild.AddGroup;
import com.mayblackcat.common.vaild.ListValue;
import com.mayblackcat.common.vaild.UpdateGroup;
import com.mayblackcat.common.vaild.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author mayblackcat
 * @email 1923384291@qq.com
 * @date 2021-08-16 10:56:29
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	private Long brandId;

	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交")
	@NotBlank(message = "品牌名不能为空",groups = {UpdateGroup.class})
	private String name;

	/**
	 * 品牌logo地址
	 */
	@NotEmpty
	@URL(message = "logo名必须为合法的url地址",groups = {UpdateGroup.class})
	private String logo;

	/**
	 * 介绍
	 */
	private String descript;

	/**
	 * 显示状态[0-不显示；1-显示]
	 * @ListValue:自定义注解
	 * 自定义校验
	 * 1)、编写一个自定义的校验注解
	 * 2)、编写一个自定义的校验器@Constraint(validatedBy = { ListValueConstraintValidator.class })
	 * 3)、关联自定义的校验器和自定义的校验注解
	 * 4)、实现自定义校验注解必须继承三个元注解：
	 * 		@Documented
	 * 		@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
	 * 		@Retention(RUNTIME)
	 */

	@ListValue(values={0,1},groups = {UpdateGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;

	/**
	 * 检索首字母
	 * @Pattern:用于自定义注解
	 */
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字母检索必须为字母", groups = {AddGroup.class})
	private String firstLetter;

	/**
	 * 排序
	 * @Min:
	 */
	@Min(value = 0,message = "排序必须为正整数", groups = {AddGroup.class})
	private Integer sort;

}
